# -*- coding:utf-8 -*-

import logging

logger = logging.getLogger()

logger1 = logging.getLogger('mylogger')
logger1.setLevel(logging.DEBUG)

logger2 = logging.getLogger('mylogger')
logger2.setLevel(logging.INFO)

logger3 = logging.getLogger('mylogger.child1')
logger3.setLevel(logging.WARNING)

ch = logging.StreamHandler()


formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s -%(message)s')

ch.setFormatter(formatter)

logger.addHandler(ch)

logger1.addHandler(ch)

logger2.addHandler(ch)

logger3.addHandler(ch)

logger.debug("logger debug message")
logger.info("logger info message")
logger.warning("logger warning message")
logger.error('logger error message')  
logger.critical('logger critical message') 

print "\n"

logger1.debug('logger1 debug message')  
logger1.info('logger1 info message') 
logger1.warning('logger1 warning message') 
logger1.error('logger1 error message') 
logger1.critical('logger1 critical message')  

print "\n"

logger2.debug('logger1 debug message')  
logger2.info('logger1 info message') 
logger2.warning('logger1 warning message') 
logger2.error('logger1 error message') 
logger2.critical('logger1 critical message') 

print "\n"

logger3.debug('logger1 debug message')  
logger3.info('logger1 info message') 
logger3.warning('logger1 warning message') 
logger3.error('logger1 error message') 
logger3.critical('logger1 critical message') 
